<?php

class ImageStyleAdmin
{
    private $_db;
    
    public function __construct()
    {
        $this->_db = Db::getInstance();
    }
    
    public function showStyles()
    {   
        return $this->_db->qri("select * from `image_styles`");   
    }
    
    public function addStyle($name, $options)
    {
        if ($this->_db->q("insert into `image_styles` (name, options) values ('".$name."', '".serialize($options)."')"))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    
    public function updateStyle($id, $options)
    {
        if ($this->_db->q("update `image_styles` set `options` = '".serialize($options)."' where `id` = ".$id))
        {
            return true;
        }
        else
        {
            return false;
        }
       
    }
    
    public function deleteStyle($id)
    {
        if ($this->_db->q("delete from `image_styles` where `id` = ".$id))
        {
            return true;
        }
        else
        {
            return false;
        }
 
    }
    
}

?>
